get_accounts(self, **params)
This is assuming you have multiple accounts for the user
In [1]:
import pandas as pd
import oandapy
import configparser
config = configparser.ConfigParser()
config.read('../config/config_v1.ini')
account_id = config['oanda']['account_id']
api_key = config['oanda']['api_key']
oanda = oandapy.API(environment="practice",
access_token=api_key)
For a detailed explanation of the above, please refer to Rates Information.
In [2]:
response = oanda.get_accounts()
print(response)
In [3]:
pd.DataFrame(response['accounts'])
Out[3]:
get_account(self, account_id, **params)
In [4]:
response = oanda.get_account(account_id)
print(response)
In [5]:
pd.Series(response)
Out[5]:
In [6]:
print(response['unrealizedPl'])